package com.noble.meether.fragment.rob;

import com.noble.meether.chat.msgtype.base.BaseMessage;
import com.noble.library.utils.JsonUtil;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * 抢聊大厅相关消息
 */
public class RobMessage extends BaseMessage {
    private long vcId;      //  渠道ID
    private String cName;   // 渠道
    private String cKey;    // 渠道加密key

    public RobMessage() {
        super();
    }

    /**
     * 女发： 抢中消息Content
     */
    public RobMessage(long vcId, String cName, String cKey) {
        Map<String, Object> jsonMap = new HashMap<>();
        jsonMap.put("IdRecChat", vcId);
        jsonMap.put("CName", cName);
        jsonMap.put("CKey", cKey);
        super.setContent(JsonUtil.mapToJSONString(jsonMap));
    }

    @Override
    public BaseMessage parseJson(String jsonStr) {
        super.parseJson(jsonStr);
        JSONObject object = JsonUtil.getJsonObject(jsonStr);
        this.setVcId(object.optLong("IdRecChat"));
        this.setcName(object.optString("CName"));
        this.setcKey(object.optString("CKey"));
        return this;
    }

    public String getcName() {
        return cName;
    }

    public void setcName(String cName) {
        this.cName = cName;
    }

    public long getVcId() {
        return vcId;
    }

    public void setVcId(long vcId) {
        this.vcId = vcId;
    }

    public String getcKey() {
        return cKey;
    }

    public void setcKey(String cKey) {
        this.cKey = cKey;
    }
}
